--[[
    Lua 5.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio
]]

-- lua实现oop原理1

vicky = {}
vicky.username = "vicky"
vicky["password"] = "123456"
vicky.age = 27

print(vicky)
print(vicky["username"])
print(vicky.password)
print(vicky["age"])

function vicky:getUsername()
    return vicky.username
end

function vicky:setUsername(username)
    vicky.username = username
end

vicky:setUsername("newName")
print(vicky:getUsername())